package cn.pacerx.running.db.domain;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Set;

import cn.pacerx.running.db.enums.ActivityStatusEnum;
import cn.pacerx.running.db.enums.ActivityTypeEnum;
import cn.pacerx.running.db.enums.GroupTypeEnum;
import cn.pacerx.running.db.typehandler.EnumOrdinalCustomizerTypeHandler;
import cn.pacerx.running.db.typehandler.StringSetTypeHandler;
import io.mybatis.provider.Entity;
import lombok.Data;

@Data
@Entity.Table("activity")
public class Activity {
    @Entity.Column(id = true, useGeneratedKeys = true, insertable = false, updatable = false)
    private Long id;

    private Long userId;

    private String userName;

    private String title;

    private String coverUrl;

    @Entity.Column(typeHandler = EnumOrdinalCustomizerTypeHandler.class)
    private ActivityTypeEnum type;

    @Entity.Column(typeHandler = EnumOrdinalCustomizerTypeHandler.class)
    private GroupTypeEnum groupType;

    @Entity.Column(typeHandler = StringSetTypeHandler.class)
    private Set<String> tag;

    private LocalDate startDate;

    private LocalDate endDate;

    private String address;

    private BigDecimal longitude;

    private BigDecimal latitude;

    private Integer personNum;

    private BigDecimal minSpeed;

    private BigDecimal maxSpeed;

    private BigDecimal distance;

    @Entity.Column(typeHandler = StringSetTypeHandler.class)
    private Set<String> extraService;

    private String detail;

    @Entity.Column(typeHandler = EnumOrdinalCustomizerTypeHandler.class)
    private ActivityStatusEnum status;

    @Entity.Column(updatable = false, insertable = false)
    private LocalDateTime addTime;

    @Entity.Column(updatable = false, insertable = false)
    private LocalDateTime updateTime;
}
